package org.example;

import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.TableEnvironment;

public class FlinkBatchDelete {
    public static void main(String[] args) {
        final EnvironmentSettings settings = EnvironmentSettings.newInstance().inBatchMode().build();
        settings.getConfiguration().setString("table.display.max-column-width", "50");
        TableEnvironment tableEnv = TableEnvironment.create(settings);

        String sql1 = "CREATE CATALOG paimon WITH (\n" +
                "    'type' = 'paimon',\n" +
                "    'warehouse' = 'file:///tmp/paimon'\n" +
                ");\n";
        System.out.println(sql1);
        tableEnv.executeSql(sql1);

        String sql2 = "DELETE FROM `paimon`.`default`.`user_behavior` WHERE\n" +
                "user_id in ('000b7c9f4aac04327a90365c9b6c0fe7c0de1cf699875ee1dc784257da53b301ddb39bd443235d5ba0dd8f8db0a04f27e311',\n" +
                "'002faa55e0139b2c7e783e5f4cbcc0c273fb26e5ff4bba4069965a4135918ff8eb5692bc3fa29037e279e0e3f8aa9b7efc47',\n" +
                "'0033a3d1614014ad8d5834de0a2618237b46625c14fd7035860f205b62343c3ff77a814108ca468595e424c4055d0e881fd2',\n" +
                "'003bb310dc8d904f644e286400b0ed107e47f7a100cd9c3502f00535d62da96057542ec577559da9f7f6fd06eb82ebb85762',\n" +
                "'0046e38b79e48c915369d7a6ecb9bf3376070943f28ab6687da669f80ffae9d38e27d05f7fe1e34e377cc09331946b25c853',\n" +
                "'004949de6333512e39fd941ec976a6adbd4971ec759b24e44f8a8df72416473bd3de44146a7b88f6fd5827684a39965efffe',\n" +
                "'004d3a7d7b172c2c6093983378803fdadd7ddb484649b7ad916dbff3a727bb3f2795abaeed27fce70650cccd1df3e5aacb5e',\n" +
                "'006c64b0315eb6567f2dbdcae312b71d0e6911c21938b32b207ff564194747940028e781dd8c5f05552fd868682398eab354',\n" +
                "'007bfa4d3f29a159c43b8fb55363b88da8aaf294b678265be95c1d0e0daaa315eef75f630c6ab0c095d9916e0912b4f85f2a',\n" +
                "'00935b9dee5f95d9ab6cdb94daee74e0caf02cc729983d4abeb0d2755f6d8b2419f595f662d1fc808fe5d0959c65b1a1a51a');";
        System.out.println(sql2);
        tableEnv.executeSql(sql2);
    }
}
